package com.example.bigevent.mapper;

import com.example.bigevent.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    //根据用户名查询
    @Select("select * from user where username=#{username}")//实际开发禁止用*，需要全查就把所有的字段打上去
    User findByUserName(String username);
    //添加
    @Insert("insert into user(username,password,create_time,update_time)"+" values(#{username},#{password},now(),now())")
    void add(String username, String md5String);

    @Update("update user set nickname=#{nickname},email=#{email},update_time=#{updateTime} where id=#{id}")//这里的updateTime是实体对象的属性名
    void update(User user);


}
